package com.servlet;

import com.Imp.OManagementMapperImpl;
import com.entity.OManagement;
import com.mapper.OManagementMapper;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class OrderManagementController extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        // 处理订单列表数据，例如将其放入 request 或进行其他操作
        // ...
    }
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //获取订单号
        int orderId= Integer.parseInt(request.getParameter("orderId"));
        OManagementMapper OManagementMapper = new OManagementMapperImpl();
        OManagement OManagement = OManagementMapper.getOrdersByorderId(orderId);
        OManagement.setOrderState("已送达");
        OManagementMapper.updateOrder(OManagement);
        response.sendRedirect("orderInformation.jsp");
    }
}
